{#
/**
 * @file
 * Grid component
 *
 * See component.wingsuit.yml for usage.
 */
#}
{# SETTINGS #}
{% set columns = columns|default(2) %}
{% set columns_width = columns_width|default('equal') %}

{# Gap #}
{% set gutter = gutter|default('default') %}
{% set gutter_classes = pattern_configuration('grid', '', 'gutter')[gutter] %}
{# Container #}
{% set configuration = pattern_configuration('grid', '', 'columns')[columns][columns_width] %}
{% set classes = ([
  'grid',
  configuration,
  gutter_classes,
]) | sort | join(' ') | trim %}

{% set attributes = attributes|default(create_attribute()).addClass(classes) %}

{# TEMPLATE #}
{% if configuration is not empty %}
  <div {{ attributes }}>
    {% block cells %}
      {% for cell_counter, cell in cells %}
        {% block cell_outer %}
          <div>
            {% block cell_inner %}
              {{ cell }}
            {% endblock %}
          </div>
        {% endblock %}
      {%- endfor -%}
    {% endblock %}
  </div>
{% else %}
  No configuration found for "{{ columns }}/{{ configuration }}".
{% endif %}
